package com.xmtlxx.sacw.mapper;

import com.xmtlxx.common.annotation.DataColumn;
import com.xmtlxx.common.annotation.DataPermission;
import com.xmtlxx.sacw.domain.EvaluateInfo;
import com.xmtlxx.sacw.domain.vo.EvaluateInfoVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 评估信息Mapper接口
 *
 * @author hergreen
 * @date 2024/07/15 11:19
 **/
public interface EvaluateInfoMapper extends BaseMapper<EvaluateInfo> {

    /**
     * 更新删除
     * @author hergreen
     * @date 2024/07/16 14:05
     * @param id id
     * @return int
     */
    default boolean updateDelById(String id) {
        return this.updateById(new EvaluateInfo(id, "1"))>0;
    }

    /**
     * 根据条件分页查询评估
     *
     * @param evaluateInfo 评估
     * @return Page Estimate
     */
    @DataPermission({
            @DataColumn(key = "tenantName", value = "e.create_by"),
            @DataColumn(key = "deptName", value = "e.dept_id"),
            @DataColumn(key = "userName", value = "e.create_by")
    })
    Page<EvaluateInfoVo> selectPageEvaluateList(@Param("page") Page<EvaluateInfoVo> page,
                                                @Param("evaluate") EvaluateInfo evaluateInfo);

    /**
     * 查询评估列表
     *
     * @param evaluateInfo 评估
     * @return 评估集合
     */
    @DataPermission({
            @DataColumn(key = "tenantName", value = "e.create_by"),
            @DataColumn(key = "deptName", value = "e.dept_id"),
            @DataColumn(key = "userName", value = "e.create_by")
    })
    List<EvaluateInfoVo> selectEvaluateList(@Param("evaluate") EvaluateInfo evaluateInfo);

}
